Skip to content

fix(sync-models): reconcile limit.output and variants drift on existing entries (#1799) - #9917

Merged
dezren39 merged 1 commit into
mainfrom
queue/15169-1799-sync-models-reconcile
Nov 14, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/15169-1799-sync-models-reconcile

Conversation

@dezren39

@dezren39 dezren39 commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Fixes #1799.

Problem

The antigravity "existing model" update branch in bin/sync-models.mjs judged drift by limit.context only and wrote variants only when the existing entry had none — so a wrong limit.output and a stale effort-variant set survived every sync while the run reported the config up-to-date, and the sync never converged.

Change

  • New planModelReconciliation(existing, limits, variants) in bin/sync-models.mjs: plans one update per drifted key — the full desired limit whenever context or output differs (or the limit is missing), and the desired variants whenever they differ from the variants built from the current effort set. An already-correct entry plans no updates, so a converged sync records no edits and no write churn.
  • Comparison is order-insensitive (jsonValueEqual): key order in the parsed config follows the file, and a key-order difference is not drift.
  • A desired empty variants set plans nothing — the sync never strips variants it did not build.
  • The update branch now applies the plan (same edit records and one totalUpdated count per reconciled model as before).

Scope note: the codex acceptance item is moot

The issue's second acceptance item targeted the openai-codex update branch. That sync was retired 2026-11-03 with the provider definition (see the comment in bin/sync-models.mjs: "openai-codex: retired 2026-11-03 — the provider definition was deleted"), so there is no codex branch left to reconcile at current main. The live branch with the defect shape was the antigravity one, fixed here.

Tests

Regression tests in bin/sync-models.test.mjs in the file's verbatim-extraction style, oracle: the plan for an entry is exactly the set of keys whose desired value differs under order-insensitive equality.

  • output-only drift is corrected; variants drift is corrected; context drift and a missing limit are corrected; variants are added to an entry that has none; both-drift plans both updates; an already-correct entry (either key order) plans no updates; an empty desired variants set strips nothing.

Run on the laptop worktree: node --test bin/sync-models.test.mjs — 46 pass, 0 fail (39 existing + 7 new).

Queue: task 15169 (triage packet; fix done in the same claim per the inline-triage rule), lane code-a.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Summary by CodeRabbit

  • Bug Fixes
    • Model synchronization now updates differing variants and context or output limits. Object key order does not affect variant comparisons, and existing variants are preserved when no variants are specified.
  • Tests
    • Added coverage for model updates, missing limits, key-order-insensitive comparisons, and empty desired variants.

@dezren39
dezren39 requested a review from a team as a code owner November 14, 2026 11:11
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-14T11:12:01.676599Z
We couldn’t complete this review. Comment @codex review to try again.
b3fc1c4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The model sync now detects differences in variants and both context and output limits. It applies and records planned updates. Tests cover drift cases, already-matching entries, and empty desired variants.

Changes: Model reconciliation

Layer / File(s) Summary
Compare desired and existing model state
bin/sync-models.mjs
Added structural JSON comparison that ignores object key order. The reconciliation planner identifies differences in non-empty desired variants and in context or output limits.
Apply and test reconciliation updates
bin/sync-models.mjs, bin/sync-models.test.mjs
The sync loop applies and records planned updates. Tests cover limit and variant drift, missing limits and variants, simultaneous updates, key-order differences, and empty desired variants.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Minimal · up to b3fc1

This change makes the model sync correct drifted output limits and variant sets on existing entries, and leaves up-to-date entries untouched. It affects only a developer sync script, and tests cover the main cases. Merge risk is minimal.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive Issue #1799 antigravity requirements are met by the reviewed diff. planModelReconciliation (bin/sync-models.mjs) plans a full limit update when context or output differs or the limit is missin… Confirm at the reviewed head that the openai-codex update branch (issue line ~583 pattern codexProv.models[m.slug].limit?.context !== 1000000) is absent, or that the retirement comment accurately describes the code. If the branch is prese…
Passed Passed checks: 3 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: reconciling limit.output and variants drift on existing model entries in sync-models. The raw summary confirms the changes match this, including the planModelReconcili…
Out of Scope Changes check Passed The diff changes only bin/sync-models.mjs and bin/sync-models.test.mjs. In bin/sync-models.mjs the changes are the new helpers jsonValueEqual and planModelReconciliation, plus the antigravity upda…
Full details: Title check

Explanation

The title names the main change: reconciling limit.output and variants drift on existing model entries in sync-models. The raw summary confirms the changes match this, including the planModelReconciliation logic and its tests. The title is specific and accurate, though it is 87 characters, longer than ideal.

Full details: Out of Scope Changes check

Explanation

The diff changes only bin/sync-models.mjs and bin/sync-models.test.mjs. In bin/sync-models.mjs the changes are the new helpers jsonValueEqual and planModelReconciliation, plus the antigravity update branch that applies their plan. Each change serves the reconciliation objective of #1799. No unrelated code paths were modified in the reviewed diff. The test file changes were not inspected, but their stated purpose (regression tests for #1799) is directly connected to the objective.

Full details: Linked Issues check

Explanation

Issue #1799 antigravity requirements are met by the reviewed diff. planModelReconciliation (bin/sync-models.mjs) plans a full limit update when context or output differs or the limit is missing. It plans a variants update when the desired set is non-empty and differs under jsonValueEqual, which is order-insensitive. A converged entry plans no updates. The update branch applies the plan and counts one totalUpdated per model. Two requirements are not established. (1) The codex acceptance item in #1799 (limit.output compared to 128000 in the openai-codex branch) is not addressed by this diff. The PR states that branch was retired on 2026-11-03, and the diff does not touch any codex code. I did not confirm at the reviewed head that the codex branch is absent. (2) The 7 regression tests in bin/sync-models.test.mjs were not inspected, so the required test coverage is unverified. The PR reports 46 pass, 0 fail, but this is an author report, not evidence I checked.

Resolution

Confirm at the reviewed head that the openai-codex update branch (issue line ~583 pattern codexProv.models[m.slug].limit?.context !== 1000000) is absent, or that the retirement comment accurately describes the code. If the branch is present, it must also compare limit.output against 128000. Inspect bin/sync-models.test.mjs to confirm the seven listed regression cases (output-only drift, variants drift, already-correct entry with no edit, and others) exist and assert the planned edits.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 59be79b9-4c4e-4482-9493-b8bbbbe8bb3a
Commits

Reviewing files that changed from the base of the PR and between d997fb4 and b3fc1c4.

Files selected for processing: 2

  • bin/sync-models.mjs
  • bin/sync-models.test.mjs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sync-models: existing entries are never reconciled when limit.context already matches — a wrong limit.output and stale variants survive every sync

1 participant